home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 November / Freeware November 1998.img / dist / fw_emacs.idb / usr / freeware / info / emacs-21.z / emacs-21 (.txt)
GNU Info File  |  1998-10-27  |  49KB  |  834 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.63 from the
  2. input file emacs.texi.
  3. File: emacs,  Node: Quitting,  Next: Lossage,  Prev: Customization,  Up: Top
  4. Quitting and Aborting
  5. =====================
  6. `C-g'
  7.      Quit.  Cancel running or partially typed command.
  8. `C-]'
  9.      Abort innermost recursive editing level and cancel the command
  10.      which invoked it (`abort-recursive-edit').
  11. `ESC ESC ESC'
  12.      Either quit or abort, whichever makes sense
  13.      (`keyboard-escape-quit').
  14. `M-x top-level'
  15.      Abort all recursive editing levels that are currently executing.
  16. `C-x u'
  17.      Cancel a previously made change in the buffer contents (`undo').
  18.    There are two ways of canceling commands which are not finished
  19. executing: "quitting" with `C-g', and "aborting" with `C-]' or `M-x
  20. top-level'.  Quitting cancels a partially typed command or one which is
  21. already running.  Aborting exits a recursive editing level and cancels
  22. the command that invoked the recursive edit.  (*Note Recursive Edit::.)
  23.    Quitting with `C-g' is used for getting rid of a partially typed
  24. command, or a numeric argument that you don't want.  It also stops a
  25. running command in the middle in a relatively safe way, so you can use
  26. it if you accidentally give a command which takes a long time.  In
  27. particular, it is safe to quit out of killing; either your text will
  28. *all* still be in the buffer, or it will *all* be in the kill ring (or
  29. maybe both).  Quitting an incremental search does special things
  30. documented under searching; in general, it may take two successive
  31. `C-g' characters to get out of a search (*note Incremental Search::.).
  32.    `C-g' works by setting the variable `quit-flag' to `t' the instant
  33. `C-g' is typed; Emacs Lisp checks this variable frequently and quits if
  34. it is non-`nil'.  `C-g' is only actually executed as a command if you
  35. type it while Emacs is waiting for input.
  36.    If you quit with `C-g' a second time before the first `C-g' is
  37. recognized, you activate the "emergency escape" feature and return to
  38. the shell.  *Note Emergency Escape::.
  39.    There may be times when you cannot quit.  When Emacs is waiting for
  40. the operating system to do something, quitting is impossible unless
  41. special pains are taken for the particular system call within Emacs
  42. where the waiting occurs.  We have done this for the system calls that
  43. users are likely to want to quit from, but it's possible you will find
  44. another.  In one very common case--waiting for file input or output
  45. using NFS--Emacs itself knows how to quit, but most NFS implementations
  46. simply do not allow user programs to stop waiting for NFS when the NFS
  47. server is hung.
  48.    Aborting with `C-]' (`abort-recursive-edit') is used to get out of a
  49. recursive editing level and cancel the command which invoked it.
  50. Quitting with `C-g' does not do this, and could not do this, because it
  51. is used to cancel a partially typed command *within* the recursive
  52. editing level.  Both operations are useful.  For example, if you are in
  53. a recursive edit and type `C-u 8' to enter a numeric argument, you can
  54. cancel that argument with `C-g' and remain in the recursive edit.
  55.    The command `ESC ESC ESC' (`keyboard-escape-quit') can either quit
  56. or abort.  This key was defined because ESC is used to "get out" in
  57. many PC programs.  It can cancel a prefix argument, clear a selected
  58. region, or get out of a Query Replace, like `C-g'.  It can get out of
  59. the minibuffer or a recursive edit, like `C-]'.  It can also get out of
  60. splitting the frame into multiple windows, like `C-x 1'.  One thing it
  61. cannot do, however, is stop a command that is running.  That's because
  62. it executes as an ordinary command, and Emacs doesn't notice it until
  63. it is ready for a command.
  64.    The command `M-x top-level' is equivalent to "enough" `C-]' commands
  65. to get you out of all the levels of recursive edits that you are in.
  66. `C-]' gets you out one level at a time, but `M-x top-level' goes out
  67. all levels at once.  Both `C-]' and `M-x top-level' are like all other
  68. commands, and unlike `C-g', in that they take effect only when Emacs is
  69. ready for a command.  `C-]' is an ordinary key and has its meaning only
  70. because of its binding in the keymap.  *Note Recursive Edit::.
  71.    `C-x u' (`undo') is not strictly speaking a way of canceling a
  72. command, but you can think of it as canceling a command that already
  73. finished executing.  *Note Undo::.
  74. File: emacs,  Node: Lossage,  Next: Bugs,  Prev: Quitting,  Up: Top
  75. Dealing with Emacs Trouble
  76. ==========================
  77.    This section describes various conditions in which Emacs fails to
  78. work normally, and how to recognize them and correct them.
  79. * Menu:
  80. * DEL Gets Help::       What to do if DEL doesn't delete.
  81. * Stuck Recursive::     `[...]' in mode line around the parentheses.
  82. * Screen Garbled::      Garbage on the screen.
  83. * Text Garbled::        Garbage in the text.
  84. * Unasked-for Search::  Spontaneous entry to incremental search.
  85. * Memory Full::         How to cope when you run out of memory.
  86. * After a Crash::       Recovering editing in an Emacs session that crashed.
  87. * Emergency Escape::    Emergency escape--
  88.                           What to do if Emacs stops responding.
  89. * Total Frustration::   When you are at your wits' end.
  90. File: emacs,  Node: DEL Gets Help,  Next: Stuck Recursive,  Up: Lossage
  91. If DEL Fails to Delete
  92. ----------------------
  93.    If you find that DEL enters Help like `Control-h' instead of
  94. deleting a character, your terminal is sending the wrong code for DEL.
  95. You can work around this problem by changing the keyboard translation
  96. table (*note Keyboard Translations::.).
  97. File: emacs,  Node: Stuck Recursive,  Next: Screen Garbled,  Prev: DEL Gets Help,  Up: Lossage
  98. Recursive Editing Levels
  99. ------------------------
  100.    Recursive editing levels are important and useful features of Emacs,
  101. but they can seem like malfunctions to the user who does not understand
  102. them.
  103.    If the mode line has square brackets `[...]' around the parentheses
  104. that contain the names of the major and minor modes, you have entered a
  105. recursive editing level.  If you did not do this on purpose, or if you
  106. don't understand what that means, you should just get out of the
  107. recursive editing level.  To do so, type `M-x top-level'.  This is
  108. called getting back to top level.  *Note Recursive Edit::.
  109. File: emacs,  Node: Screen Garbled,  Next: Text Garbled,  Prev: Stuck Recursive,  Up: Lossage
  110. Garbage on the Screen
  111. ---------------------
  112.    If the data on the screen looks wrong, the first thing to do is see
  113. whether the text is really wrong.  Type `C-l', to redisplay the entire
  114. screen.  If the screen appears correct after this, the problem was
  115. entirely in the previous screen update.  (Otherwise, see *Note Text
  116. Garbled::.)
  117.    Display updating problems often result from an incorrect termcap
  118. entry for the terminal you are using.  The file `etc/TERMS' in the Emacs
  119. distribution gives the fixes for known problems of this sort.
  120. `INSTALL' contains general advice for these problems in one of its
  121. sections.  Very likely there is simply insufficient padding for certain
  122. display operations.  To investigate the possibility that you have this
  123. sort of problem, try Emacs on another terminal made by a different
  124. manufacturer.  If problems happen frequently on one kind of terminal
  125. but not another kind, it is likely to be a bad termcap entry, though it
  126. could also be due to a bug in Emacs that appears for terminals that
  127. have or that lack specific features.
  128. File: emacs,  Node: Text Garbled,  Next: Unasked-for Search,  Prev: Screen Garbled,  Up: Lossage
  129. Garbage in the Text
  130. -------------------
  131.    If `C-l' shows that the text is wrong, try undoing the changes to it
  132. using `C-x u' until it gets back to a state you consider correct.  Also
  133. try `C-h l' to find out what command you typed to produce the observed
  134. results.
  135.    If a large portion of text appears to be missing at the beginning or
  136. end of the buffer, check for the word `Narrow' in the mode line.  If it
  137. appears, the text you don't see is probably still present, but
  138. temporarily off-limits.  To make it accessible again, type `C-x n w'.
  139. *Note Narrowing::.
  140. File: emacs,  Node: Unasked-for Search,  Next: Memory Full,  Prev: Text Garbled,  Up: Lossage
  141. Spontaneous Entry to Incremental Search
  142. ---------------------------------------
  143.    If Emacs spontaneously displays `I-search:' at the bottom of the
  144. screen, it means that the terminal is sending `C-s' and `C-q' according
  145. to the poorly designed xon/xoff "flow control" protocol.
  146.    If this happens to you, your best recourse is to put the terminal in
  147. a mode where it will not use flow control, or give it so much padding
  148. that it will never send a `C-s'.  (One way to increase the amount of
  149. padding is to set the variable `baud-rate' to a larger value.  Its
  150. value is the terminal output speed, measured in the conventional units
  151. of baud.)
  152.    If you don't succeed in turning off flow control, the next best thing
  153. is to tell Emacs to cope with it.  To do this, call the function
  154. `enable-flow-control'.
  155.    Typically there are particular terminal types with which you must use
  156. flow control.  You can conveniently ask for flow control on those
  157. terminal types only, using `enable-flow-control-on'.  For example, if
  158. you find you must use flow control on VT-100 and H19 terminals, put the
  159. following in your `.emacs' file:
  160.      (enable-flow-control-on "vt100" "h19")
  161.    When flow control is enabled, you must type `C-\' to get the effect
  162. of a `C-s', and type `C-^' to get the effect of a `C-q'.  (These
  163. aliases work by means of keyboard translations; see *Note Keyboard
  164. Translations::.)
  165. File: emacs,  Node: Memory Full,  Next: After a Crash,  Prev: Unasked-for Search,  Up: Lossage
  166. Running out of Memory
  167. ---------------------
  168.    If you get the error message `Virtual memory exceeded', save your
  169. modified buffers with `C-x s'.  This method of saving them has the
  170. smallest need for additional memory.  Emacs keeps a reserve of memory
  171. which it makes available when this error happens; that should be enough
  172. to enable `C-x s' to complete its work.
  173.    Once you have saved your modified buffers, you can exit this Emacs
  174. job and start another, or you can use `M-x kill-some-buffers' to free
  175. space in the current Emacs job.  If you kill buffers containing a
  176. substantial amount of text, you can safely go on editing.  Emacs refills
  177. its memory reserve automatically when it sees sufficient free space
  178. available, in case you run out of memory another time.
  179.    Do not use `M-x buffer-menu' to save or kill buffers when you run
  180. out of memory, because the buffer menu needs a fair amount memory
  181. itself, and the reserve supply may not be enough.
  182. File: emacs,  Node: After a Crash,  Next: Emergency Escape,  Prev: Memory Full,  Up: Lossage
  183. Recovery After a Crash
  184. ----------------------
  185.    If Emacs or the computer crashes, you can recover the files you were
  186. editing at the time of the crash from their auto-save files.  To do
  187. this, start Emacs again and type the command `M-x recover-session'.
  188.    This command initially displays a buffer which lists interrupted
  189. session files, each with its date.  You must choose which session to
  190. recover from.  Typically the one you want is the most recent one.  Move
  191. point to the one you choose, and type `C-c C-c'.
  192.    Then `recover-session' asks about each of the files that you were
  193. editing during that session; it asks whether to recover that file.  If
  194. you answer `y' for a file, it shows the dates of that file and its
  195. auto-save file, then asks once again whether to recover that file.  For
  196. the second question, you must confirm with `yes'.  If you do, Emacs
  197. visits the file but gets the text from the auto-save file.
  198.    When `recover-session' is done, the files you've chosen to recover
  199. are present in Emacs buffers.  You should then save them.  Only
  200. this--saving them--updates the files themselves.
  201. File: emacs,  Node: Emergency Escape,  Next: Total Frustration,  Prev: After a Crash,  Up: Lossage
  202. Emergency Escape
  203. ----------------
  204.    Because at times there have been bugs causing Emacs to loop without
  205. checking `quit-flag', a special feature causes Emacs to be suspended
  206. immediately if you type a second `C-g' while the flag is already set,
  207. so you can always get out of GNU Emacs.  Normally Emacs recognizes and
  208. clears `quit-flag' (and quits!) quickly enough to prevent this from
  209. happening.
  210.    When you resume Emacs after a suspension caused by multiple `C-g', it
  211. asks two questions before going back to what it had been doing:
  212.      Auto-save? (y or n)
  213.      Abort (and dump core)? (y or n)
  214. Answer each one with `y' or `n' followed by RET.
  215.    Saying `y' to `Auto-save?' causes immediate auto-saving of all
  216. modified buffers in which auto-saving is enabled.
  217.    Saying `y' to `Abort (and dump core)?' causes an illegal instruction
  218. to be executed, dumping core.  This is to enable a wizard to figure out
  219. why Emacs was failing to quit in the first place.  Execution does not
  220. continue after a core dump.  If you answer `n', execution does
  221. continue.  With luck, GNU Emacs will ultimately check `quit-flag' and
  222. quit normally.  If not, and you type another `C-g', it is suspended
  223. again.
  224.    If Emacs is not really hung, just slow, you may invoke the double
  225. `C-g' feature without really meaning to.  Then just resume and answer
  226. `n' to both questions, and you will arrive at your former state.
  227. Presumably the quit you requested will happen soon.
  228.    The double-`C-g' feature is turned off when Emacs is running under
  229. the X Window System, since you can use the window manager to kill Emacs
  230. or to create another window and run another program.
  231. File: emacs,  Node: Total Frustration,  Prev: Emergency Escape,  Up: Lossage
  232. Help for Total Frustration
  233. --------------------------
  234.    If using Emacs (or something else) becomes terribly frustrating and
  235. none of the techniques described above solve the problem, Emacs can
  236. still help you.
  237.    First, if the Emacs you are using is not responding to commands, type
  238. `C-g C-g' to get out of it and then start a new one.
  239.    Second, type `M-x doctor RET'.
  240.    The doctor will help you feel better.  Each time you say something to
  241. the doctor, you must end it by typing RET RET.  This lets the doctor
  242. know you are finished.
  243. File: emacs,  Node: Bugs,  Next: Contributing,  Prev: Lossage,  Up: Top
  244. Reporting Bugs
  245. ==============
  246.    Sometimes you will encounter a bug in Emacs.  Although we cannot
  247. promise we can or will fix the bug, and we might not even agree that it
  248. is a bug, we want to hear about problems you encounter.  Often we agree
  249. they are bugs and want to fix them.
  250.    To make it possible for us to fix a bug, you must report it.  In
  251. order to do so effectively, you must know when and how to do it.
  252. * Menu:
  253. * Criteria:  Bug Criteria.     Have you really found a bug?
  254. * Understanding Bug Reporting::     How to report a bug effectively.
  255. * Checklist::             Steps to follow for a good bug report.
  256. * Sending Patches::         How to send a patch for GNU Emacs.
  257. File: emacs,  Node: Bug Criteria,  Next: Understanding Bug Reporting,  Up: Bugs
  258. When Is There a Bug
  259. -------------------
  260.    If Emacs executes an illegal instruction, or dies with an operating
  261. system error message that indicates a problem in the program (as
  262. opposed to something like "disk full"), then it is certainly a bug.
  263.    If Emacs updates the display in a way that does not correspond to
  264. what is in the buffer, then it is certainly a bug.  If a command seems
  265. to do the wrong thing but the problem corrects itself if you type
  266. `C-l', it is a case of incorrect display updating.
  267.    Taking forever to complete a command can be a bug, but you must make
  268. certain that it was really Emacs's fault.  Some commands simply take a
  269. long time.  Type `C-g' and then `C-h l' to see whether the input Emacs
  270. received was what you intended to type; if the input was such that you
  271. *know* it should have been processed quickly, report a bug.  If you
  272. don't know whether the command should take a long time, find out by
  273. looking in the manual or by asking for assistance.
  274.    If a command you are familiar with causes an Emacs error message in a
  275. case where its usual definition ought to be reasonable, it is probably a
  276.    If a command does the wrong thing, that is a bug.  But be sure you
  277. know for certain what it ought to have done.  If you aren't familiar
  278. with the command, or don't know for certain how the command is supposed
  279. to work, then it might actually be working right.  Rather than jumping
  280. to conclusions, show the problem to someone who knows for certain.
  281.    Finally, a command's intended definition may not be best for editing
  282. with.  This is a very important sort of problem, but it is also a
  283. matter of judgment.  Also, it is easy to come to such a conclusion out
  284. of ignorance of some of the existing features.  It is probably best not
  285. to complain about such a problem until you have checked the
  286. documentation in the usual ways, feel confident that you understand it,
  287. and know for certain that what you want is not available.  If you are
  288. not sure what the command is supposed to do after a careful reading of
  289. the manual, check the index and glossary for any terms that may be
  290. unclear.
  291.    If after careful rereading of the manual you still do not understand
  292. what the command should do, that indicates a bug in the manual, which
  293. you should report.  The manual's job is to make everything clear to
  294. people who are not Emacs experts--including you.  It is just as
  295. important to report documentation bugs as program bugs.
  296.    If the on-line documentation string of a function or variable
  297. disagrees with the manual, one of them must be wrong; that is a bug.
  298. File: emacs,  Node: Understanding Bug Reporting,  Next: Checklist,  Prev: Bug Criteria,  Up: Bugs
  299. Understanding Bug Reporting
  300. ---------------------------
  301.    When you decide that there is a bug, it is important to report it
  302. and to report it in a way which is useful.  What is most useful is an
  303. exact description of what commands you type, starting with the shell
  304. command to run Emacs, until the problem happens.
  305.    The most important principle in reporting a bug is to report *facts*,
  306. not hypotheses or categorizations.  It is always easier to report the
  307. facts, but people seem to prefer to strain to posit explanations and
  308. report them instead.  If the explanations are based on guesses about
  309. how Emacs is implemented, they will be useless; we will have to try to
  310. figure out what the facts must have been to lead to such speculations.
  311. Sometimes this is impossible.  But in any case, it is unnecessary work
  312. for us.
  313.    For example, suppose that you type `C-x C-f /glorp/baz.ugh RET',
  314. visiting a file which (you know) happens to be rather large, and Emacs
  315. prints out `I feel pretty today'.  The best way to report the bug is
  316. with a sentence like the preceding one, because it gives all the facts
  317. and nothing but the facts.
  318.    Do not assume that the problem is due to the size of the file and
  319. say, "When I visit a large file, Emacs prints out `I feel pretty
  320. today'." This is what we mean by "guessing explanations".  The problem
  321. is just as likely to be due to the fact that there is a `z' in the file
  322. name.  If this is so, then when we got your report, we would try out
  323. the problem with some "large file", probably with no `z' in its name,
  324. and not find anything wrong.  There is no way in the world that we
  325. could guess that we should try visiting a file with a `z' in its name.
  326.    Alternatively, the problem might be due to the fact that the file
  327. starts with exactly 25 spaces.  For this reason, you should make sure
  328. that you inform us of the exact contents of any file that is needed to
  329. reproduce the bug.  What if the problem only occurs when you have typed
  330. the `C-x C-a' command previously?  This is why we ask you to give the
  331. exact sequence of characters you typed since starting the Emacs session.
  332.    You should not even say "visit a file" instead of `C-x C-f' unless
  333. you *know* that it makes no difference which visiting command is used.
  334. Similarly, rather than saying "if I have three characters on the line,"
  335. say "after I type `RET A B C RET C-p'," if that is the way you entered
  336. the text.
  337. File: emacs,  Node: Checklist,  Next: Sending Patches,  Prev: Understanding Bug Reporting,  Up: Bugs
  338. Checklist for Bug Reports
  339. -------------------------
  340.    The best way to send a bug report is to mail it electronically to the
  341. Emacs maintainers at `bug-gnu-emacs@prep.ai.mit.edu'.  (If you want to
  342. suggest a change as an improvement, use the same address.)
  343.    If you'd like to read the bug reports, you can find them on the
  344. newsgroup `gnu.emacs.bug'; keep in mind, however, that as a spectator
  345. you should not criticize anything about what you see there.  The
  346. purpose of bug reports is to give information to the Emacs maintainers.
  347. Spectators are welcome only as long as they do not interfere with
  348. this.  In particular, some bug reports contain large amounts of data;
  349. spectators should not complain about this.
  350.    Please do not post bug reports using netnews; mail is more reliable
  351. than netnews about reporting your correct address, which we may need in
  352. order to ask you for more information.
  353.    If you can't send electronic mail, then mail the bug report on paper
  354. or machine-readable media to this address:
  355. GNU Emacs Bugs
  356. Free Software Foundation
  357. 59 Temple Place, Suite 330
  358. Boston, MA 02111-1307 USA
  359.    We do not promise to fix the bug; but if the bug is serious, or
  360. ugly, or easy to fix, chances are we will want to.
  361.    A convenient way to send a bug report for Emacs is to use the command
  362. `M-x report-emacs-bug'.  This sets up a mail buffer (*note Sending
  363. Mail::.) and automatically inserts *some* of the essential information.
  364. However, it cannot supply all the necessary information; you should
  365. still read and follow the guidelines below, so you can enter the other
  366. crucial information by hand before you send the message.
  367.    To enable maintainers to investigate a bug, your report should
  368. include all these things:
  369.    * The version number of Emacs.  Without this, we won't know whether
  370.      there is any point in looking for the bug in the current version
  371.      of GNU Emacs.
  372.      You can get the version number by typing `M-x emacs-version RET'.
  373.      If that command does not work, you probably have something other
  374.      than GNU Emacs, so you will have to report the bug somewhere else.
  375.    * The type of machine you are using, and the operating system name
  376.      and version number.  `M-x emacs-version RET' provides this
  377.      information too.  Copy its output from the `*Messages*' buffer, so
  378.      that you get it all and get it accurately.
  379.    * The operands given to the `configure' command when Emacs was
  380.      installed.
  381.    * A complete list of any modifications you have made to the Emacs
  382.      source.  (We may not have time to investigate the bug unless it
  383.      happens in an unmodified Emacs.  But if you've made modifications
  384.      and you don't tell us, you are sending us on a wild goose chase.)
  385.      Be precise about these changes.  A description in English is not
  386.      enough--send a context diff for them.
  387.      Adding files of your own, or porting to another machine, is a
  388.      modification of the source.
  389.    * Details of any other deviations from the standard procedure for
  390.      installing GNU Emacs.
  391.    * The complete text of any files needed to reproduce the bug.
  392.      If you can tell us a way to cause the problem without visiting any
  393.      files, please do so.  This makes it much easier to debug.  If you
  394.      do need files, make sure you arrange for us to see their exact
  395.      contents.  For example, it can often matter whether there are
  396.      spaces at the ends of lines, or a newline after the last line in
  397.      the buffer (nothing ought to care whether the last line is
  398.      terminated, but try telling the bugs that).
  399.    * The precise commands we need to type to reproduce the bug.
  400.      The easy way to record the input to Emacs precisely is to write a
  401.      dribble file.  To start the file, execute the Lisp expression
  402.           (open-dribble-file "~/dribble")
  403.      using `M-:' or from the `*scratch*' buffer just after starting
  404.      Emacs.  From then on, Emacs copies all your input to the specified
  405.      dribble file until the Emacs process is killed.
  406.    * For possible display bugs, the terminal type (the value of
  407.      environment variable `TERM'), the complete termcap entry for the
  408.      terminal from `/etc/termcap' (since that file is not identical on
  409.      all machines), and the output that Emacs actually sent to the
  410.      terminal.
  411.      The way to collect the terminal output is to execute the Lisp
  412.      expression
  413.           (open-termscript "~/termscript")
  414.      using `M-:' or from the `*scratch*' buffer just after starting
  415.      Emacs.  From then on, Emacs copies all terminal output to the
  416.      specified termscript file as well, until the Emacs process is
  417.      killed.  If the problem happens when Emacs starts up, put this
  418.      expression into your `.emacs' file so that the termscript file
  419.      will be open when Emacs displays the screen for the first time.
  420.      Be warned: it is often difficult, and sometimes impossible, to fix
  421.      a terminal-dependent bug without access to a terminal of the type
  422.      that stimulates the bug.
  423.    * A description of what behavior you observe that you believe is
  424.      incorrect.  For example, "The Emacs process gets a fatal signal,"
  425.      or, "The resulting text is as follows, which I think is wrong."
  426.      Of course, if the bug is that Emacs gets a fatal signal, then one
  427.      can't miss it.  But if the bug is incorrect text, the maintainer
  428.      might fail to notice what is wrong.  Why leave it to chance?
  429.      Even if the problem you experience is a fatal signal, you should
  430.      still say so explicitly.  Suppose something strange is going on,
  431.      such as, your copy of the source is out of sync, or you have
  432.      encountered a bug in the C library on your system.  (This has
  433.      happened!)  Your copy might crash and the copy here might not.  If
  434.      you *said* to expect a crash, then when Emacs here fails to crash,
  435.      we would know that the bug was not happening.  If you don't say to
  436.      expect a crash, then we would not know whether the bug was
  437.      happening--we would not be able to draw any conclusion from our
  438.      observations.
  439.    * If the manifestation of the bug is an Emacs error message, it is
  440.      important to report the precise text of the error message, and a
  441.      backtrace showing how the Lisp program in Emacs arrived at the
  442.      error.
  443.      To get the error message text accurately, copy it from the
  444.      `*Messages*' buffer into the bug report.  Copy all of it, not just
  445.      part.
  446.      To make a backtrace for the error, evaluate the Lisp expression
  447.      `(setq debug-on-error t)' before the error happens (that is to
  448.      say, you must execute that expression and then make the bug
  449.      happen).  This causes the error to run the Lisp debugger, which
  450.      shows you a backtrace.  Copy the text of the debugger's backtrace
  451.      into the bug report.
  452.      This use of the debugger is possible only if you know how to make
  453.      the bug happen again.  If you can't make it happen again, at least
  454.      copy the whole error message.
  455.    * Check whether any programs you have loaded into the Lisp world,
  456.      including your `.emacs' file, set any variables that may affect the
  457.      functioning of Emacs.  Also, see whether the problem happens in a
  458.      freshly started Emacs without loading your `.emacs' file (start
  459.      Emacs with the `-q' switch to prevent loading the init file.)  If
  460.      the problem does *not* occur then, you must report the precise
  461.      contents of any programs that you must load into the Lisp world in
  462.      order to cause the problem to occur.
  463.    * If the problem does depend on an init file or other Lisp programs
  464.      that are not part of the standard Emacs system, then you should
  465.      make sure it is not a bug in those programs by complaining to
  466.      their maintainers first.  After they verify that they are using
  467.      Emacs in a way that is supposed to work, they should report the
  468.      bug.
  469.    * If you wish to mention something in the GNU Emacs source, show the
  470.      line of code with a few lines of context.  Don't just give a line
  471.      number.
  472.      The line numbers in the development sources don't match those in
  473.      your sources.  It would take extra work for the maintainers to
  474.      determine what code is in your version at a given line number, and
  475.      we could not be certain.
  476.    * Additional information from a C debugger such as GDB might enable
  477.      someone to find a problem on a machine which he does not have
  478.      available.  If you don't know how to use GDB, please read the GDB
  479.      manual--it is not very long, and using GDB is easy.  You can find
  480.      the GDB distribution, including the GDB manual in online form, in
  481.      most of the same places you can find the Emacs distribution.
  482.      However, you need to think when you collect the additional
  483.      information if you want it to show what causes the bug.
  484.      For example, many people send just a backtrace, but that is not
  485.      very useful by itself.  A simple backtrace with arguments often
  486.      conveys little about what is happening inside GNU Emacs, because
  487.      most of the arguments listed in the backtrace are pointers to Lisp
  488.      objects.  The numeric values of these pointers have no
  489.      significance whatever; all that matters is the contents of the
  490.      objects they point to (and most of the contents are themselves
  491.      pointers).
  492.      To provide useful information, you need to show the values of Lisp
  493.      objects in Lisp notation.  Do this for each variable which is a
  494.      Lisp object, in several stack frames near the bottom of the stack.
  495.      Look at the source to see which variables are Lisp objects,
  496.      because the debugger thinks of them as integers.
  497.      To show a variable's value in Lisp syntax, first print its value,
  498.      then use the user-defined GDB command `pr' to print the Lisp
  499.      object in Lisp syntax.  (If you must use another debugger, call
  500.      the function `debug_print' with the object as an argument.)  The
  501.      `pr' command is defined by the file `.gdbinit' in the `src'
  502.      subdirectory, and it works only if you are debugging a running
  503.      process (not with a core dump).
  504.      To make Lisp errors stop Emacs and return to GDB, put a breakpoint
  505.      at `Fsignal'.
  506.      To find out which Lisp functions are running, using GDB, move up
  507.      the stack, and each time you get to a frame for the function
  508.      `Ffuncall', type these GDB commands:
  509.           p *args
  510.           pr
  511.      To print the first argument that the function received, use these
  512.      commands:
  513.           p args[1]
  514.           pr
  515.      You can print the other arguments likewise.  The argument `nargs'
  516.      of `Ffuncall' says how many arguments `Ffuncall' received; these
  517.      include the Lisp function itself and the arguments for that
  518.      function.
  519.    * If the symptom of the bug is that Emacs fails to respond, don't
  520.      assume Emacs is "hung"--it may instead be in an infinite loop.  To
  521.      find out which, make the problem happen under GDB and stop Emacs
  522.      once it is not responding.  (If Emacs is using X Windows directly,
  523.      you can stop Emacs by typing `C-c' at the GDB job.)  Then try
  524.      stepping with `step'.  If Emacs is hung, the `step' command won't
  525.      return.  If it is looping, `step' will return.
  526.      If this shows Emacs is hung in a system call, stop it again and
  527.      examine the arguments of the call.  In your bug report, state
  528.      exactly where in the source the system call is, and what the
  529.      arguments are.
  530.      If Emacs is in an infinite loop, please determine where the loop
  531.      starts and ends.  The easiest way to do this is to use the GDB
  532.      command `finish'.  Each time you use it, Emacs resumes execution
  533.      until it exits one stack frame.  Keep typing `finish' until it
  534.      doesn't return--that means the infinite loop is in the stack frame
  535.      which you just tried to finish.
  536.      Stop Emacs again, and use `finish' repeatedly again until you get
  537.      *back to* that frame.  Then use `next' to step through that frame.
  538.      By stepping, you will see where the loop starts and ends.  Also
  539.      please examine the data being used in the loop and try to
  540.      determine why the loop does not exit when it should.  Include all
  541.      of this information in your bug report.
  542.    Here are some things that are not necessary in a bug report:
  543.    * A description of the envelope of the bug--this is not necessary
  544.      for a reproducible bug.
  545.      Often people who encounter a bug spend a lot of time investigating
  546.      which changes to the input file will make the bug go away and which
  547.      changes will not affect it.
  548.      This is often time consuming and not very useful, because the way
  549.      we will find the bug is by running a single example under the
  550.      debugger with breakpoints, not by pure deduction from a series of
  551.      examples.  You might as well save time by not searching for
  552.      additional examples.
  553.      Of course, if you can find a simpler example to report *instead* of
  554.      the original one, that is a convenience.  Errors in the output
  555.      will be easier to spot, running under the debugger will take less
  556.      time, etc.
  557.      However, simplification is not vital; if you can't do this or
  558.      don't have time to try, please report the bug with your original
  559.      test case.
  560.    * A system call trace of Emacs execution.
  561.      System call traces are very useful for certain special kinds of
  562.      debugging, but in most cases they give little useful information.
  563.      It is therefore strange that many people seem to think that *the*
  564.      way to report information about a crash is to send a system call
  565.      trace.
  566.      In most programs, a backtrace is normally far, far more
  567.      informative than a system call trace.  Even in Emacs, a simple
  568.      backtrace is generally more informative, though to give full
  569.      information you should supplement the backtrace by displaying
  570.      variable values and printing them as Lisp objects with `pr' (see
  571.      above).
  572.    * A patch for the bug.
  573.      A patch for the bug is useful if it is a good one.  But don't omit
  574.      the other information that a bug report needs, such as the test
  575.      case, on the assumption that a patch is sufficient.  We might see
  576.      problems with your patch and decide to fix the problem another
  577.      way, or we might not understand it at all.  And if we can't
  578.      understand what bug you are trying to fix, or why your patch
  579.      should be an improvement, we mustn't install it.
  580.      *Note Sending Patches::, for guidelines on how to make it easy for
  581.      us to understand and install your patches.
  582.    * A guess about what the bug is or what it depends on.
  583.      Such guesses are usually wrong.  Even experts can't guess right
  584.      about such things without first using the debugger to find the
  585.      facts.
  586. File: emacs,  Node: Sending Patches,  Prev: Checklist,  Up: Bugs
  587. Sending Patches for GNU Emacs
  588. -----------------------------
  589.    If you would like to write bug fixes or improvements for GNU Emacs,
  590. that is very helpful.  When you send your changes, please follow these
  591. guidelines to make it easy for the maintainers to use them.  If you
  592. don't follow these guidelines, your information might still be useful,
  593. but using it will take extra work.  Maintaining GNU Emacs is a lot of
  594. work in the best of circumstances, and we can't keep up unless you do
  595. your best to help.
  596.    * Send an explanation with your changes of what problem they fix or
  597.      what improvement they bring about.  For a bug fix, just include a
  598.      copy of the bug report, and explain why the change fixes the bug.
  599.      (Referring to a bug report is not as good as including it, because
  600.      then we will have to look it up, and we have probably already
  601.      deleted it if we've already fixed the bug.)
  602.    * Always include a proper bug report for the problem you think you
  603.      have fixed.  We need to convince ourselves that the change is
  604.      right before installing it.  Even if it is correct, we might have
  605.      trouble understanding it if we don't have a way to reproduce the
  606.      problem.
  607.    * Include all the comments that are appropriate to help people
  608.      reading the source in the future understand why this change was
  609.      needed.
  610.    * Don't mix together changes made for different reasons.  Send them
  611.      *individually*.
  612.      If you make two changes for separate reasons, then we might not
  613.      want to install them both.  We might want to install just one.  If
  614.      you send them all jumbled together in a single set of diffs, we
  615.      have to do extra work to disentangle them--to figure out which
  616.      parts of the change serve which purpose.  If we don't have time
  617.      for this, we might have to ignore your changes entirely.
  618.      If you send each change as soon as you have written it, with its
  619.      own explanation, then two changes never get tangled up, and we can
  620.      consider each one properly without any extra work to disentangle
  621.      them.
  622.    * Send each change as soon as that change is finished.  Sometimes
  623.      people think they are helping us by accumulating many changes to
  624.      send them all together.  As explained above, this is absolutely
  625.      the worst thing you could do.
  626.      Since you should send each change separately, you might as well
  627.      send it right away.  That gives us the option of installing it
  628.      immediately if it is important.
  629.    * Use `diff -c' to make your diffs.  Diffs without context are hard
  630.      to install reliably.  More than that, they are hard to study; we
  631.      must always study a patch to decide whether we want to install it.
  632.      Unidiff format is better than contextless diffs, but not as easy
  633.      to read as `-c' format.
  634.      If you have GNU diff, use `diff -c -F'^[_a-zA-Z0-9$]+ *('' when
  635.      making diffs of C code.  This shows the name of the function that
  636.      each change occurs in.
  637.    * Write the change log entries for your changes.  This is both to
  638.      save us the extra work of writing them, and to help explain your
  639.      changes so we can understand them.
  640.      The purpose of the change log is to show people where to find what
  641.      was changed.  So you need to be specific about what functions you
  642.      changed; in large functions, it's often helpful to indicate where
  643.      within the function the change was.
  644.      On the other hand, once you have shown people where to find the
  645.      change, you need not explain its purpose in the change log.  Thus,
  646.      if you add a new function, all you need to say about it is that it
  647.      is new.  If you feel that the purpose needs explaining, it
  648.      probably does--but put the explanation in comments in the code.
  649.      It will be more useful there.
  650.      Please read the `ChangeLog' files in the `src' and `lisp'
  651.      directories to see what sorts of information to put in, and to
  652.      learn the style that we use.  If you would like your name to
  653.      appear in the header line, showing who made the change, send us
  654.      the header line.  *Note Change Log::.
  655.    * When you write the fix, keep in mind that we can't install a
  656.      change that would break other systems.  Please think about what
  657.      effect your change will have if compiled on another type of system.
  658.      Sometimes people send fixes that *might* be an improvement in
  659.      general--but it is hard to be sure of this.  It's hard to install
  660.      such changes because we have to study them very carefully.  Of
  661.      course, a good explanation of the reasoning by which you concluded
  662.      the change was correct can help convince us.
  663.      The safest changes are changes to the configuration files for a
  664.      particular machine.  These are safe because they can't create new
  665.      bugs on other machines.
  666.      Please help us keep up with the workload by designing the patch in
  667.      a form that is clearly safe to install.
  668. File: emacs,  Node: Contributing,  Next: Service,  Prev: Bugs,  Up: Top
  669. Contributing to Emacs Development
  670. =================================
  671.    If you would like to help pretest Emacs releases to assure they work
  672. well, or if you would like to work on improving Emacs, please contact
  673. the maintainers at `bug-gnu-emacs@prep.ai.mit.edu'.  A pretester should
  674. be prepared to investigate bugs as well as report them.  If you'd like
  675. to work on improving Emacs, please ask for suggested projects or
  676. suggest your own ideas.
  677.    If you have already written an improvement, please tell us about it.
  678. If you have not yet started work, it is useful to contact
  679. `bug-gnu-emacs@prep.ai.mit.edu' before you start; it might be possible
  680. to suggest ways to make your extension fit in better with the rest of
  681. Emacs.
  682. File: emacs,  Node: Service,  Next: Command Arguments,  Prev: Contributing,  Up: Top
  683. How To Get Help with GNU Emacs
  684. ==============================
  685.    If you need help installing, using or changing GNU Emacs, there are
  686. two ways to find it:
  687.    * Send a message to the mailing list
  688.      `help-gnu-emacs@prep.ai.mit.edu', or post your request on
  689.      newsgroup `gnu.emacs.help'.  (This mailing list and newsgroup
  690.      interconnect, so it does not matter which one you use.)
  691.    * Look in the service directory for someone who might help you for a
  692.      fee.  The service directory is found in the file named
  693.      `etc/SERVICE' in the Emacs distribution.
  694. File: emacs,  Node: Command Arguments,  Next: Antinews,  Prev: Service,  Up: Top
  695. Command Line Arguments
  696. **********************
  697.    GNU Emacs supports command line arguments to request various actions
  698. when invoking Emacs.  These are for compatibility with other editors and
  699. for sophisticated activities.  We don't recommend using them for
  700. ordinary editing.
  701.    Arguments starting with `-' are "options".  Other arguments specify
  702. files to visit.  Emacs visits the specified files while it starts up.
  703. The last file name on your command line becomes the current buffer; the
  704. other files are also present in other buffers.
  705.    You can use options to specify various other things, such as the size
  706. and position of the X window Emacs uses, its colors, and so on.  A few
  707. options support advanced usage, such as running Lisp functions on files
  708. in batch mode.  The sections of this chapter describe the available
  709. options, arranged according to their purpose.
  710.    There are two ways of writing options: the short forms that start
  711. with a single `-', and the long forms that start with `--'.  For
  712. example, `-d' is a short form and `--display' is the corresponding long
  713. form.
  714.    The long forms with `--' are easier to remember, but longer to type.
  715. However, you don't have to spell out the whole option name; any
  716. unambiguous abbreviation is enough.  When a long option takes an
  717. argument, you can use either a space or an equal sign to separate the
  718. option name and the argument.  Thus, you can write either `--display
  719. sugar-bombs:0.0' or `--display=sugar-bombs:0.0'.  We recommend an equal
  720. sign because it makes the relationship clearer, and the tables below
  721. always show an equal sign.
  722.    Most options specify how to initialize Emacs, or set parameters for
  723. the Emacs session.  We call them "initial options".  A few options
  724. specify things to do: for example, load libraries, call functions, or
  725. exit Emacs.  These are called "action options".  These and file names
  726. together are called "action arguments".  Emacs processes all the action
  727. arguments in the order they are written.
  728. * Menu:
  729. * Action Arguments::    Arguments to visit files, load libraries,
  730.               and call functions.
  731. * Initial Options::     Arguments that take effect while starting Emacs.
  732. * Command Example::     Examples of using command line arguments.
  733. * Resume Arguments::    Specifying arguments when you resume a running Emacs.
  734. * Environment::         Environment variables that Emacs uses.
  735. * Display X::           Changing the default display and using remote login.
  736. * Font X::            Choosing a font for text, under X.
  737. * Colors X::            Choosing colors, under X.
  738. * Window Size X::       Start-up window size, under X.
  739. * Borders X::            Internal and external borders, under X.
  740. * Title X::             Specifying the initial frame's title.
  741. * Icons X::             Choosing what sort of icon to use, under X.
  742. * Resources X::         Advanced use of classes and resources, under X.
  743. * Lucid Resources::     X resources for Lucid menus.
  744. * Motif Resources::     X resources for Motif menus.
  745. File: emacs,  Node: Action Arguments,  Next: Initial Options,  Up: Command Arguments
  746. Action Arguments
  747. ================
  748.    Here is a table of the action arguments and options:
  749. `FILE'
  750.      Visit FILE using `find-file'.  *Note Visiting::.
  751. `+LINENUM FILE'
  752.      Visit FILE using `find-file', then go to line number LINENUM in it.
  753. `-l FILE'
  754. `--load=FILE'
  755.      Load a file FILE of Lisp code with the function `load'.  *Note
  756.      Lisp Libraries::.
  757. `-f FUNCTION'
  758. `--funcall=FUNCTION'
  759.      Call Lisp function FUNCTION with no arguments.
  760. `--eval EXPRESSION'
  761.      Evaluate Lisp expression EXPRESSION.
  762. `--insert=FILE'
  763.      Insert the contents of FILE into the current buffer.  This is like
  764.      what `M-x insert-file' does.  *Note Misc File Ops::.
  765. `--kill'
  766.      Exit from Emacs without asking for confirmation.
  767.    The init file can access the values of the action arguments as the
  768. elements of a list in the variable `command-line-args'.  The init file
  769. can override the normal processing of the action arguments, or define
  770. new ones, by reading and setting this variable.
  771. File: emacs,  Node: Initial Options,  Next: Command Example,  Prev: Action Arguments,  Up: Command Arguments
  772. Initial Options
  773. ===============
  774.    The initial options specify parameter for the Emacs session.  This
  775. section describes the more general initial options; some other options
  776. specifically related to X Windows appear in the following sections.
  777.    Some initial options affect the loading of init files.  The normal
  778. actions of Emacs are to first load `site-start.el' if it exists, then
  779. your own init file `~/.emacs' if it exists, and finally `default.el' if
  780. it exists; certain options prevent loading of some of these files or
  781. substitute other files for them.
  782. `-t DEVICE'
  783. `--terminal=DEVICE'
  784.      Use DEVICE as the device for terminal input and output.
  785. `-d DISPLAY'
  786. `--display=DISPLAY'
  787.      Use the X Window System and use the display named DISPLAY to open
  788.      the initial Emacs frame.
  789. `-nw'
  790. `--no-windows'
  791.      Don't communicate directly with X, disregarding the `DISPLAY'
  792.      environment variable even if it is set.
  793. `-batch'
  794. `--batch'
  795.      Run Emacs in "batch mode", which means that the text being edited
  796.      is not displayed and the standard terminal interrupt characters
  797.      such as `C-z' and `C-c' continue to have their normal effect.
  798.      Emacs in batch mode outputs to `stderr' only what would normally
  799.      be printed in the echo area under program control.
  800.      Batch mode is used for running programs written in Emacs Lisp from
  801.      shell scripts, makefiles, and so on.  Normally the `-l' option or
  802.      `-f' option will be used as well, to invoke a Lisp program to do
  803.      the batch processing.
  804.      `-batch' implies `-q' (do not load an init file).  It also causes
  805.      Emacs to kill itself after all command options have been
  806.      processed.  In addition, auto-saving is not done except in buffers
  807.      for which it has been explicitly requested.
  808. `--no-init-file'
  809.      Do not load your Emacs init file `~/.emacs', or `default.el'
  810.      either.
  811. `--no-site-file'
  812.      Do not load `site-start.el'.  The options `-q', `-u' and `-batch'
  813.      have no effect on the loading of this file--this is the only
  814.      option that blocks it.
  815. `-u USER'
  816. `--user=USER'
  817.      Load USER's Emacs init file `~USER/.emacs' instead of your own.
  818. `--debug-init'
  819.      Enable the Emacs Lisp debugger for errors in the init file.
  820. File: emacs,  Node: Command Example,  Next: Resume Arguments,  Prev: Initial Options,  Up: Command Arguments
  821. Command Argument Example
  822. ========================
  823.    Here is an example of using Emacs with arguments and options.  It
  824. assumes you have a Lisp program file called `hack-c.el' which, when
  825. loaded, performs some useful operation on current buffer, expected to be
  826. a C program.
  827.      emacs -batch foo.c -l hack-c -f save-buffer >& log
  828. This says to visit `foo.c', load `hack-c.el' (which makes changes in
  829. the visited file), save `foo.c' (note that `save-buffer' is the
  830. function that `C-x C-s' is bound to), and then exit back to the shell
  831. (because of `-batch').  `-batch' also guarantees there will be no
  832. problem redirecting output to `log', because Emacs will not assume that
  833. it has a display terminal to work with.
  834.